package com.bxji.spring.eurekaclient.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RestController;

import com.bxji.spring.eurekaclient.UserFeignClient;
import com.bxji.spring.ms.commons.domain.User;

@RestController
public class ConsumerController {

    /**
     * 通过接口类调用运程服务
     */
    @Autowired
    private UserFeignClient userFeignClient;


    /**
     * 调用服务接口
     */
    @GetMapping("/user/{id}")
    public User findById(@PathVariable Long id) {
        return userFeignClient.findById(id);
    }

    @GetMapping("/test")
    public User testPost(User user) {
        return userFeignClient.postUser(user);
    }

 

}
